package com.monkeygroup.mygoplus.view.home.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.monkeygroup.mygoplus.R;
import com.monkeygroup.mygoplus.base.BaseActivity;

/**
 * 我要刊登
 * Created by cumt on 2017/5/18.
 */

public class PublishedFirstActivity extends BaseActivity implements View.OnClickListener{

    public static void gotoActivity(Activity activity,String propertytype) {
        Intent intent = new Intent(activity,
                PublishedFirstActivity.class);

        intent.putExtra("propertytype", propertytype);
        activity.startActivity(intent);
    }

    private LayoutInflater inflater;

    private ImageView imgBack;
    private TextView txtTitle;
    private LinearLayout layout_shortcut;

    private String propertytype;

    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.ll_house:
                PublishedSecondActivity.gotoActivity(PublishedFirstActivity.this,propertytype,"1");
            break;
            case R.id.ll_store:
                PublishedSecondActivity.gotoActivity(PublishedFirstActivity.this,propertytype,"2");
                break;
            case R.id.ll_office:
                PublishedSecondActivity.gotoActivity(PublishedFirstActivity.this,propertytype,"3");
                break;
            case R.id.ll_workshop:
                PublishedSecondActivity.gotoActivity(PublishedFirstActivity.this,propertytype,"4");
                break;
            case R.id.ll_stall:
                PublishedSecondActivity.gotoActivity(PublishedFirstActivity.this,propertytype,"5");
                break;
            case R.id.ll_land:
                PublishedSecondActivity.gotoActivity(PublishedFirstActivity.this,propertytype,"6");
                break;
            default:
                break;
        }


    }

    @Override
    public void setContentView() {
        setContentView(R.layout.publish_choose_category);
    }

    @Override
    public void initView() {

        inflater = LayoutInflater.from(PublishedFirstActivity.this);

        imgBack = (ImageView) findViewById(R.id.img_back);
        txtTitle = (TextView) findViewById(R.id.txt_title);
        layout_shortcut= (LinearLayout) findViewById(R.id.layout_shortcut);
        layout_shortcut.setVisibility(View.INVISIBLE);
        txtTitle.setText("選擇用途");

        Intent intent = this.getIntent();
        Bundle bundle =  intent.getExtras();
        propertytype = bundle.getString("propertytype");

    }

    @Override
    public void setListener() {

        findViewById(R.id.ll_house).setOnClickListener(this);
        findViewById(R.id.ll_store).setOnClickListener(this);
        findViewById(R.id.ll_office).setOnClickListener(this);
        findViewById(R.id.ll_workshop).setOnClickListener(this);
        findViewById(R.id.ll_stall).setOnClickListener(this);
        findViewById(R.id.ll_land).setOnClickListener(this);

    }

    @Override
    public void doEvent() {

        imgBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

    }
}
